<!DOCTYPE html>
<html>

	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>Amazon后台管理系统</title>
		<link href="/stylesheets/style.css" rel="stylesheet" type="text/css" />
		<link rel='stylesheet' href='/bootstrap/css/bootstrap.css' />
		<script type="text/javascript" src="/bootstrap/js/jquery.js"></script>
		<script type="text/javascript" src="/bootstrap/js/bootstrap.js"></script>
	</head>

	<body style="background-color:#1c77ac; background-image:url(images/light.png); background-repeat:no-repeat; background-position:center top; overflow:hidden;">

		<div id="mainBody">
			<div id="cloud1" class="cloud"></div>
			<div id="cloud2" class="cloud"></div>
		</div>
		<%- include('./header.ejs',{isLogin:isLogin,username:username,goLogin:false,goRegister:false})%>
		<div class="rightinfo">
			<div class="formbody">
				<%if(isNew){%>
				<div class="formtitle"><span>商品信息</span><span style="margin-left: 1150px;border: 0;"><a href="/">返回首页&gt;</a></span></div>
				<form action="/addGood" method="post" enctype="multipart/form-data">
					<div class="forminfo">

						<li><label>商品名称</label><input name="goodname" type="text" class="dfinput" /><i>标题不能超过30个字符</i></li>
						<li><label>关键字</label><input name="keyword" type="text" class="dfinput" /><i>多个关键字用,隔开</i></li>
						<li><label>价格</label><cite><input name="price" type="text" class="dfinput"/></li>
						<li><label>商品描述</label><textarea name="goodinfo" cols="" rows="" class="textinput"></textarea></li>
						<li><label>商品图片</label><input type="file" class="" name="pictrue" ></li>
						<li><button type="submit" class="btn btn-info">发布</button></li>
					</div>
				</form>
				<%}else if(isDetail){%>
				<div class="formtitle"><span>商品信息</span><span style="margin-left: 1150px;border: 0;"><a href="/">返回首页&gt;</a></span></div>
				<table class="imgtable">
					<thead>
						<tr>
							<th>标题</th>
							<th>内容</th>
						</tr>
					</thead>
					<tbody>
						<tr>
							<td>品名</td>
							<td>
								<%= result.goodname%>
							</td>
						</tr>
						<tr class="odd">
							<td>分类</td>
							<td>
								<%= result.keyword%>
							</td>
						</tr>
						<tr>
							<td>缩略图</td>
							<td><img style="width: 100px;" src="<%= result.picpath%>" /></td>
						</tr>
						<tr class="odd">
							<td>价格</td>
							<td>
								<%= result.price%>
							</td>
						</tr>
						<tr>
							<td>卖家</td>
							<td>
								<%= result.saler%>
							</td>
						</tr>
						<tr class="odd">
							<td>商品描述</td>
							<td>
								<%= result.goodinfo%>
							</td>
						</tr>
						<tr>
							<td>商品评论</td>
							<td>
								<% if(result.comments==''){%>
								暂无评论
								<%}else{%>
								<a href="/addGood/comment?id=<%= result._id%>" style="text-decoration: underline;">查看详情</a>
								<%}%>
							</td>
						</tr>
					</tbody>
				</table>
				<%}else if(isRedo){%>
				<div class="formtitle"><span>商品信息</span><span style="margin-left: 1150px;border: 0;"><a href="/">返回首页&gt;</a></span></div>
					<form action="/addGood/redo" method="post" enctype="multipart/form-data">
						<div class="forminfo">
							<li><label>商品名称</label><input name="goodname" type="text" class="dfinput" value="<%= result.goodname%>" /></li>
							<li><label>关键字</label><input name="keyword" type="text" class="dfinput" value="<%= result.keyword%>" /></li>
							<li><label>价格</label><cite><input name="price" type="text" class="dfinput" value="<%= result.price%>"/></li>
							<li><label>商品描述</label><textarea name="goodinfo" cols="" rows="" class="textinput"><%= result.goodinfo%></textarea></li>
							<li><label>更换图片</label><input type="file" class="" name="pictrue" ></li>
							<input type="hidden" class="form-control" id="id" name="id" placeholder="id" value="<%= result._id%>">
							<li><button type="submit" class="btn btn-info">更新信息</button></li>			
						</div>
					</form>
				<%}else if(isComment){%>
				<div class="formtitle"><span>商品评论</span><span style="margin-left: 1150px;border: 0;"><a href="/">返回首页&gt;</a></span></div>
				<div class="commentList">
					<% for(var i = 0;i<commentList.length;i++){%>
					<div class="cmtContent">
						<% for(var j=1;j<commentList[i].length;j++){%>
						<% if(commentList[i][j].user){%>
						<p class="usercmt">
							<span class="cmt1" style="color: deeppink;"><%= commentList[i][0]%>：</span>
							<span class="cmt2"><%= commentList[i][j].user%></span>
						</p>
						<%}else{%>
						<p class="salercmt">
							<span class="cmt1" style="color: deeppink;">您的回复：</span>
							<span class="cmt2"><%= commentList[i][j].saler%></span>
						</p>
						<%}%>
						<%}%>
						<p class="fixcmt">
							<form class="rpybox" action="/addGood/replycmt" method="post" style="overflow: hidden;display: none;">
								<textarea name="rpy" style="width: 400px;height: 80px;display: block;overflow: auto;margin-bottom: 10px;text-indent: 10px;"></textarea>
								<input type="hidden" name="id" value="<%= result._id%>" />
								<input type="hidden" name="user" value="<%= commentList[i][0]%>" />
								<input type="submit" value="提交" />
								<input type="button" value="取消" />
							</form>
							<div class="fixit">
							<a class="reply" style="cursor: pointer;">回复</a>
							<a class="delcmt" href="/addGood/delcmt?id=<%= result._id%>&user=<%= commentList[i][0]%>">删除评论</a>
							</div>
						</p>	
					</div>
					<%}%>
					
					
				</div>
				<%}%>
			</div>
			
		</div>

		<div class="loginbm">版权所有 © 1996-2017，亚马逊公司或其关联公司</div>
		<script src="/javascripts/require.js" data-main="/javascripts/main_addGood.js" type="text/javascript" defer async="true charset=" utf-8 "></script>
	</body>

</html>